package com.example.finalproject.experiments.lifecycle

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.example.finalproject.R

class LifecycleExperimentActivity : AppCompatActivity() {
    private val tag = "LifecycleActivity"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_lifecycle_experiment)
        Log.d(tag, "onCreate: LifecycleActivity")

        findViewById<Button>(R.id.btn_launch_dialog).setOnClickListener {
            val intent = Intent(this, DialogActivity::class.java)
            startActivity(intent)
        }

        findViewById<Button>(R.id.btn_launch_second).setOnClickListener {
            val intent = Intent(this, SecondActivity::class.java)
            startActivity(intent)
        }
    }

    override fun onStart() {
        super.onStart()
        Log.d(tag, "onStart: LifecycleActivity")
    }

    override fun onRestart() {
        super.onRestart()
        Log.d(tag, "onRestart: LifecycleActivity")
    }

    override fun onResume() {
        super.onResume()
        Log.d(tag, "onResume: LifecycleActivity")
    }

    override fun onPause() {
        super.onPause()
        Log.d(tag, "onPause: LifecycleActivity")
    }

    override fun onStop() {
        super.onStop()
        Log.d(tag, "onStop: LifecycleActivity")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(tag, "onDestroy: LifecycleActivity")
    }
}